Imports System.Diagnostics.Process
Imports System.Threading
Imports System.Data
Imports System.Data.OleDb
Imports CrystalDecisions.CrystalReports.Engine
Public Class MY_Report
    Inherits System.Windows.Forms.Form
    Dim WithEvents SBO_Application As SAPbouiCOM.Application
    Dim Ocompany As SAPbobsCOM.Company
    Dim DataSet1 As DataSet1
    Dim DataSet2 As DataSet2
    Dim DataSet3 As DataSet3
    Dim DataSet4 As DataSet4
    Dim DataSet5 As DataSet5
    Dim DataSet6 As DataSet6
    Dim DataSet7 As DataSet7
    Dim DataSet8 As DataSet8
    Dim DataSet9 As DataSet9
    Dim DataSet10 As DataSet10
    Dim DataSet13 As DataSet13
    Dim DataSet14 As DataSet14
    Dim DataSet15 As DataSet15
    Dim DataSet16 As DataSet16
    Dim DataSet18 As DataSet18
    Dim Report1 As ProgressReport
    Dim Report2 As Activities_Report
    Dim Report3 As R_Dog_Inventory_Report
    Dim Report4 As R_Incident_Report
    Dim Report5 As R_DayPassBalance
    Dim Report6 As R_Attendance_Report
    Dim Report7 As R_Food_Medicine
    Dim Report8 As R_NEW_TRANSPORT
    Dim Report9 As R_BORDING_REPORT
    Dim Report10 As R_Training_Report
    Dim Report11 As R_AnnualPackage
    Public Sub conn(ByVal ocompany As SAPbobsCOM.Company)
        Dim sPath As String
        sPath = IO.Directory.GetParent(Application.StartupPath).ToString
        Dim file As System.IO.StreamReader = New System.IO.StreamReader(sPath & "\K9\" & "Pwd.txt", True)
        Dim pwd As String
        pwd = file.ReadLine()
        Dim connectionString As String = ""
        connectionString = "Provider=SQLOLEDB;"
        connectionString += "Server=" + ocompany.Server + ";Database=" + ocompany.CompanyDB + ";"
        connectionString += "User ID=" & ocompany.DbUserName & ";Password=" & pwd & ""  'toshiba"
        adoOleDbConnection = New OleDbConnection(connectionString)
        Try
            file.Close()
        Catch ex As Exception

        End Try
    End Sub
    Public Sub Attendance_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet6 = New DataSet6
            adoOleDbDataAdapter.Fill(DataSet6, "ATTEN")
            Report6 = New R_Attendance_Report
            Report6.SetDataSource(DataSet6)
            CrystalReportViewer1.ReportSource = Report6
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub AnnualPack_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet18 = New DataSet18
            adoOleDbDataAdapter.Fill(DataSet18, "ANNUAL")
            Report11 = New R_AnnualPackage
            Report11.SetDataSource(DataSet18)
            CrystalReportViewer1.ReportSource = Report11
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Last_Attendance_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet6 = New DataSet6
            adoOleDbDataAdapter.Fill(DataSet6, "LASTATTEN")
            Dim Report17 As R_Last_Attendance_Report
            Report17 = New R_Last_Attendance_Report
            Report17.SetDataSource(DataSet6)
            CrystalReportViewer1.ReportSource = Report17
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub DayPass_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet5 = New DataSet5
            adoOleDbDataAdapter.Fill(DataSet5, "DAYPASS")
            Report5 = New R_DayPassBalance
            Report5.SetDataSource(DataSet5)
            CrystalReportViewer1.ReportSource = Report5
            CrystalReportViewer1.Visible = True
            CrystalReportViewer1.DisplayToolbar = True
            

            'CrystalReportViewer1.ExportReport()
            'CrystalReportViewer1.HasSearchButton = True
            'CrystalReportViewer1.HasExportButton = True
            'CrystalReportViewer1.HasPrintButton = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Prog_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet1 = New DataSet1
            adoOleDbDataAdapter.Fill(DataSet1, "PROG")
            Report1 = New ProgressReport
            Report1.SetDataSource(DataSet1)
            CrystalReportViewer1.ReportSource = Report1
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Act_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet2 = New DataSet2
            adoOleDbDataAdapter.Fill(DataSet2, "ACT")
            Report2 = New Activities_Report
            Report2.SetDataSource(DataSet2)
            CrystalReportViewer1.ReportSource = Report2
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Training_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet10 = New DataSet10
            adoOleDbDataAdapter.Fill(DataSet10, "TRAINING")
            Report10 = New R_Training_Report
            Report10.SetDataSource(DataSet10)
            CrystalReportViewer1.ReportSource = Report10
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub DogInv_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet3 = New DataSet3
            adoOleDbDataAdapter.Fill(DataSet3, "DOGINV")
            Report3 = New R_Dog_Inventory_Report
            Report3.SetDataSource(DataSet3)
            CrystalReportViewer1.ReportSource = Report3
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Incident_Report_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet4 = New DataSet4
            adoOleDbDataAdapter.Fill(DataSet4, "INREPO")
            Report4 = New R_Incident_Report
            Report4.SetDataSource(DataSet4)
            CrystalReportViewer1.ReportSource = Report4
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Food_Report_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet7 = New DataSet7
            adoOleDbDataAdapter.Fill(DataSet7, "FOOD")
            Report7 = New R_Food_Medicine
            Report7.SetDataSource(DataSet7)
            CrystalReportViewer1.ReportSource = Report7
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub NewBording_Report_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet8 = New DataSet8
            adoOleDbDataAdapter.Fill(DataSet8, "NEWTRANS")
            Report8 = New R_NEW_TRANSPORT
            Report8.SetDataSource(DataSet8)
            CrystalReportViewer1.ReportSource = Report8
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Bording_Report_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()

            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet9 = New DataSet9
            adoOleDbDataAdapter.Fill(DataSet9, "BORD")
            Report9 = New R_BORDING_REPORT
            Report9.SetDataSource(DataSet9)
            CrystalReportViewer1.ReportSource = Report9
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub

    Public Sub Attendance_Summary_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet13 = New DataSet13
            Dim Report13 As R_Summary_Atten_Report
            adoOleDbDataAdapter.Fill(DataSet13, "SUMATT")
            Report13 = New R_Summary_Atten_Report
            Report13.SetDataSource(DataSet13)
            CrystalReportViewer1.ReportSource = Report13
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Boarding_Summary_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet14 = New DataSet14
            Dim Report14 As R_Summary_Boarding_Report
            adoOleDbDataAdapter.Fill(DataSet14, "SUMBOARD")
            Report14 = New R_Summary_Boarding_Report
            Report14.SetDataSource(DataSet14)
            CrystalReportViewer1.ReportSource = Report14
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Act_Summary_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet15 = New DataSet15
            Dim Report15 As R_Summary_Act_Report
            adoOleDbDataAdapter.Fill(DataSet15, "SUMMACT")
            Report15 = New R_Summary_Act_Report
            Report15.SetDataSource(DataSet15)
            CrystalReportViewer1.ReportSource = Report15
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Training_Summary_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            DataSet16 = New DataSet16
            Dim Report16 As R_Summary_Training_Report
            adoOleDbDataAdapter.Fill(DataSet16, "SUMMTRI")
            Report16 = New R_Summary_Training_Report
            Report16.SetDataSource(DataSet16)
            CrystalReportViewer1.ReportSource = Report16
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub

    Public Sub Evaluation_Adult_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            ' Dim DataSet11 As DataSet11
            Dim DataSet11 As New DataSet11
            ' Dim Report16 As R_Summary_Training_Report
            adoOleDbDataAdapter.Fill(DataSet11, "EAdult")
            Dim Report17 As New R_Adult_Evaluationform
            Report17.SetDataSource(DataSet11)
            CrystalReportViewer1.ReportSource = Report17
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub CustSig(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            ' Dim DataSet11 As DataSet11
            Dim DataSet17 As New DataSet17
            ' Dim Report16 As R_Summary_Training_Report
            adoOleDbDataAdapter.Fill(DataSet17, "CUST")
            Dim Report18 As New R_Customer_Registration
            Report18.SetDataSource(DataSet17)
            CrystalReportViewer1.ReportSource = Report18
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub
    Public Sub Evaluation_Puppy_Report(ByVal ct1 As String, ByVal ocompany As SAPbobsCOM.Company)
        Try
            ' InitializeComponent()
            conn(ocompany)
            adoOleDbDataAdapter = New OleDbDataAdapter(ct1, adoOleDbConnection)
            ' Dim DataSet11 As DataSet11
            Dim DataSet12 As New DataSet12
            ' Dim Report16 As R_Summary_Training_Report
            adoOleDbDataAdapter.Fill(DataSet12, "EPuppy")
            Dim Report18 As New R_Puppy_Evaluationform
            Report18.SetDataSource(DataSet12)
            CrystalReportViewer1.ReportSource = Report18
            CrystalReportViewer1.Visible = True
        Catch ex As Exception
            SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
        End Try
    End Sub

    Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load

    End Sub
End Class